(function(){"use strict";BX.namespace("BX.Grid");BX.Grid.Message=function(t,e){this.parent=null;this.types=null;this.messages=null;this.popup=null;this.init(t,e)};BX.Grid.Message.prototype={init:function(t,e){this.parent=t;this.types=e;this.show();BX.addCustomEvent("BX.Main.grid:paramsUpdated",BX.proxy(this.onUpdated,this))},onUpdated:function(){this.show()},getData:function(){return this.parent.arParams.MESSAGES},isNeedShow:function(){return this.getData().length>0},show:function(){if(this.isNeedShow()){this.getPopup().setContent(this.getContent());this.getPopup().show()}},getContent:function(){var t=this.getData();var e=null;if(BX.type.isArray(t)&&t.length){var n={block:"main-grid-messages",content:[]};t.forEach(function(t){var e={block:"main-grid-message",mix:"main-grid-message-"+t.TYPE.toLowerCase(),content:[]};if(BX.type.isNotEmptyString(t.TITLE)){e.content.push({block:"main-grid-message-title",content:BX.create("div",{html:t.TITLE}).innerText})}if(BX.type.isNotEmptyString(t.TEXT)){e.content.push({block:"main-grid-message-text",content:BX.create("div",{html:t.TEXT}).innerText})}n.content.push(e)});e=BX.decl(n)}return e},getPopup:function(){if(this.popup===null){this.popup=new BX.PopupWindow(this.getPopupId(),null,{autoHide:true,overlay:.3,width:400,contentNoPaddings:true,closeByEsc:true,buttons:[new BX.PopupWindowButton({text:this.parent.getParam("CLOSE"),className:"webform-small-button-blue webform-small-button",events:{click:function(){this.popupWindow.close()}}})]})}return this.popup},getPopupId:function(){return this.parent.getContainerId()+"-main-grid-message"}}})();